<template>
  <div class="tem_brother">
    <h5>兄弟组件C</h5>
    <p>收到大哥信息：我是{{ msgA.name }}，今年{{ msgA.age }}岁了</p>
    <p>收到二哥信息：我是{{ msgB.name }}，今年{{ msgB.age }}岁了</p>
  </div>
</template>

<script>
import Bus from './bus'
export default {
  name: "brotherC",
  data() {
    return {
      name: '老三',
      age: 12,
      msgA: {
        name: 'A',
        age: 1
      },
      msgB: {
        name: 'B',
        age: 1
      }
    }
  },
  mounted() {
    Bus.$on('msg-a', msg => {
      this.msgA = msg
    });
    Bus.$on('msg-b', msg => {
      this.msgB = msg
    });
  }
}
</script>

<style scoped>

</style>
